import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

export type PageResult = {
  success: boolean;
  data: {
    /** 列表数据 */
    list: Array<any>;
    /** 总数 */
    total?: number;
  };
  errMsg: "";
};

export type DataResult = {
  success: boolean;
  data?: {};
  errMsg: "";
};

export const queryBannerList = (data?: object) => {
  return http.request<PageResult>("post", baseUrlApi("queryBannerList"), {
    data
  });
};

export const updateBannerStatus = (data?: object) => {
  return http.request<DataResult>("post", baseUrlApi("updateBannerStatus"), {
    data
  });
};

export const addOrUpdateBanner = (data?: object) => {
  return http.request<DataResult>("post", baseUrlApi("addOrUpdateBanner"), {
    data
  });
};

export const deleteBanner = (data?: object) => {
  return http.request<DataResult>("post", baseUrlApi("deleteBanner"), {
    data
  });
};
